Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class SquareTile

    Private Sub SquareTile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub SquareTile_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        Const iSide = 50  ' Kích thöôùc hình vuoâng

        Dim apt As Point() = {New Point(0, 0), New Point(iSide, 0), New Point(iSide, iSide), New Point(0, iSide)}
        Dim cx As Integer = Me.Width
        Dim cy As Integer = Me.Height
        Dim pgbrush As PathGradientBrush = New PathGradientBrush(apt, WrapMode.TileFlipXY)

        'pgbrush.SurroundColors = New Color(){Color.Red, Color.Blue, Color.White}


        e.Graphics.FillRectangle(pgbrush, 0, 0, cx, cy)
    End Sub
End Class